﻿using System;
using System.Data;
using System.Configuration;
using System.Text;
using WHC.Hotel.Entity;
using System.Collections.Generic;
using WHC.Hotel.BLL;

namespace WHC.Hotel.UI
{
    public class DictItemUtil
    {
        public static CListItem[] GetWareHouse(bool searchItem)
        {
            List<CListItem> itemList = new List<CListItem>();
            itemList.Add(new CListItem("客房仓库", "客房仓库"));
            itemList.Add(new CListItem("KTV仓库", "KTV仓库"));
            itemList.Add(new CListItem("茶室仓库", "茶室仓库"));
            if (searchItem)
            {
                itemList.Add(new CListItem("所有仓库", ""));
            }
            return itemList.ToArray();
       }

        /// <summary>
        /// 根据字典类型获取对应的CListItem集合
        /// </summary>
        /// <param name="dictTypeName"></param>
        /// <returns></returns>
        public static CListItem[] GetDictByDictType(string dictTypeName)
        {
            List<CListItem> itemList = new List<CListItem>();
            Dictionary<string, string> dict = BLLFactory<DictData>.Instance.GetDictByDictType(dictTypeName);
            foreach (string key in dict.Keys)
            {
                itemList.Add(new CListItem(key, dict[key]));
            }
            return itemList.ToArray();
        }

        /// <summary>
        /// 获得宾客类型
        /// </summary>
        /// <returns>CListItem[]</returns>
        public static CListItem[] GetCustomerType()
        {
            return GetDictByDictType("宾客类型");
        }


        /// <summary>
        /// 获得宾客类型
        /// </summary>
        /// <returns>CListItem[]</returns>
        public static CListItem[] GetProtocolUnitType()
        {
            return GetDictByDictType("协议单位类别");
        }

        /// <summary>
        /// 获得楼层
        /// </summary>
        /// <returns>CListItem[]</returns>
        public static CListItem[] GetRoomFloorType()
        {
            return GetDictByDictType("楼层");
        }

        /// <summary>
        /// 获得楼栋
        /// </summary>
        /// <returns>CListItem[]</returns>
        public static CListItem[] GetRoomBuildNumList()
        {
            return GetDictByDictType("楼区");
        }


        /// <summary>
        /// 获得宾客来源
        /// </summary>
        /// <returns>CListItem[]</returns>
        public static CListItem[] GetCustomerSource()
        {
            return GetDictByDictType("宾客来源");
        }

        /// <summary>
        /// 获得证件类型
        /// </summary>
        /// <returns>CListItem[]</returns>
        public static CListItem[] GetIDCarType()
        {
            return GetDictByDictType("证件类型");
        }

        /// <summary>
        /// 获得押金类型
        /// </summary>
        /// <returns>CListItem[]</returns>
        public static CListItem[] GetDepositType()
        {
            return GetDictByDictType("押金类型");
        }

        /// <summary>
        /// 获得付款方式
        /// </summary>
        /// <returns>CListItem[]</returns>
        public static CListItem[] GetPayType()
        {
            return GetDictByDictType("付款方式");
        }

        /// <summary>
        /// 获得服务生等级
        /// </summary>
        /// <returns>CListItem[]</returns>
        public static CListItem[] GetWaiterGrade()
        {
            return GetDictByDictType("服务生等级");
        }

        /// <summary>
        /// 获得费用登记类型
        /// </summary>
        /// <returns>CListItem[]</returns>
        public static CListItem[] GetOtherIncomeType()
        {
            return GetDictByDictType("费用登记类型");
        }

        /// <summary>
        /// 获取服务区域：如一楼、二楼等
        /// </summary>
        /// <returns></returns>
        public static CListItem[] GetRoomServiceRegion()
        {
            List<CListItem> itemList = new List<CListItem>();
            List<string> regionList = BLLFactory<Room>.Instance.GetAllRegions();
            foreach (string item in regionList)
            {
                itemList.Add(new CListItem(item, item));
            }
            return itemList.ToArray();
        }

        /// <summary>
        /// 获取服务区域：如一楼、二楼等
        /// </summary>
        /// <returns></returns>
        public static CListItem[] GetTeaServiceRegion()
        {
            List<CListItem> itemList = new List<CListItem>();
            List<TeaSuiteTypeInfo> regionList = BLLFactory<TeaSuiteType>.Instance.GetAll();
            foreach (TeaSuiteTypeInfo item in regionList)
            {
                itemList.Add(new CListItem(item.Name, item.Name));
            }
            return itemList.ToArray();
        }

        /// <summary>
        /// 获取服务区域：如一楼、二楼等
        /// </summary>
        /// <returns></returns>
        public static CListItem[] GetKTVServiceRegion()
        {
            List<CListItem> itemList = new List<CListItem>();
            List<KTVSuiteTypeInfo> regionList = BLLFactory<KTVSuiteType>.Instance.GetAll();
            foreach (KTVSuiteTypeInfo item in regionList)
            {
                itemList.Add(new CListItem(item.Name, item.Name));
            }
            return itemList.ToArray();
        }

        ///// <summary>
        ///// 转换表单状态
        ///// </summary>
        ///// <param name="type"></param>
        ///// <returns></returns>
        //public static string GetApplyStatusString(string type)
        //{
        //    return BLLFactory<DictData>.Instance.GetDictName("表单状态", type);
        //}

        ///// <summary>
        ///// 获得申请单种类
        ///// </summary>
        ///// <returns>CListItem[]</returns>
        //public static CListItem[] GetCListItem_ApplyFormType()
        //{
        //    List<CListItem> itemList = new List<CListItem>();
        //    List<AppFormInfo> list = BLLFactory<AppForm>.Instance.GetAll();
        //    foreach (AppFormInfo info in list)
        //    {
        //        itemList.Add(new CListItem(info.Formname, info.Id + ""));
        //    }

        //    return itemList.ToArray();
        //}

        ///// <summary>
        ///// 获得申请单种类名称
        ///// </summary>
        ///// <returns>CListItem[]</returns>
        //public static CListItem[] GetCListItem_ApplyFormName()
        //{
        //    List<CListItem> itemList = new List<CListItem>();
        //    List<AppFormInfo> list = BLLFactory<AppForm>.Instance.GetAll();
        //    foreach (AppFormInfo info in list)
        //    {
        //        itemList.Add(new CListItem(info.Formname, info.Formname + ""));
        //    }

        //    return itemList.ToArray();
        //}

    }
}
